﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="SignalR_Persistent.Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:TextBox ClientIDMode="Static" ID="msg" runat="server" />
        <asp:Button ClientIDMode="Static" ID="broadcast" runat="server" />

    </div>

        <div >

            <ul id="messages"></ul>
        </div>
    </form>

    <script src="http://code.jquery.com/jquery-1.7.min.js" type="text/javascript" ></script>
    <script src="Scripts/jquery.signalR-1.0.0-rc2.min.js" type="text/javascript" ></script>
    <script type="text/javascript" >

        $(function () {
            var connection = $.connection('/echo');

            connection.received(function (data) {
                $('#messages').append('<li>' + data + '</li>');
            });

            connection.start().done(function () {
                $("#broadcast").click(function () {
                    connection.send($('#msg').val());
                });
            });
        });
    </script>

</body>
</html>
